/* 剪贴簿美学风格 CSS */
:root {
    --primary-color: #8B4513;
    --secondary-color: #D2691E;
    --accent-color: #FF6B6B;
    --paper-color: #FAF3E0;
    --card-color: #FFF8DC;
    --text-color: #5D4037;
    --shadow-color: rgba(139, 69, 19, 0.2);

    /* 手写字体 */
    --handwritten-font: 'Kalam', cursive;
    --chinese-font: 'Zhi Mang Xing', cursive;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--handwritten-font), var(--chinese-font), sans-serif;
    background: linear-gradient(135deg, #FFE4B5 0%, #F5DEB3 50%, #FFE4B5 100%);
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
    color: var(--text-color);
}

/* 装饰背景元素 */
.scrapbook-decoration {
    position: fixed;
    z-index: 1;
    pointer-events: none;
}

.tape1, .tape2, .tape3 {
    width: 100px;
    height: 30px;
    background: linear-gradient(45deg,
        rgba(255, 255, 255, 0.8) 25%,
        rgba(200, 200, 200, 0.6) 25%,
        rgba(200, 200, 200, 0.6) 50%,
        rgba(255, 255, 255, 0.8) 50%,
        rgba(255, 255, 255, 0.8) 75%,
        rgba(200, 200, 200, 0.6) 75%);
    background-size: 20px 20px;
    opacity: 0.7;
    transform: rotate(-15deg);
}

.tape1 {
    top: 50px;
    left: 30px;
}

.tape2 {
    top: 150px;
    right: 40px;
    transform: rotate(10deg);
}

.tape3 {
    bottom: 100px;
    left: 50px;
    transform: rotate(-5deg);
}

.sticker1, .sticker2 {
    font-size: 2rem;
    opacity: 0.8;
}

.sticker1 {
    top: 80px;
    right: 100px;
    transform: rotate(15deg);
}

.sticker2 {
    bottom: 120px;
    right: 80px;
    transform: rotate(-10deg);
}

.polaroid-frame {
    width: 120px;
    height: 150px;
    border: 15px solid white;
    border-bottom-width: 40px;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.2);
    opacity: 0.6;
    transform: rotate(5deg);
    top: 200px;
    right: 30px;
}

/* 胶带装饰 */
.washi-tape {
    position: fixed;
    z-index: 2;
    pointer-events: none;
}

.washi-tape-1 {
    width: 150px;
    height: 40px;
    background: linear-gradient(135deg, #FFB6C1, #FFE4E1);
    opacity: 0.7;
    top: 0;
    left: 20%;
    transform: rotate(-5deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.washi-tape-2 {
    width: 120px;
    height: 30px;
    background: linear-gradient(45deg, #98D8C8, #F7DC6F);
    opacity: 0.7;
    top: 0;
    right: 30%;
    transform: rotate(8deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.washi-tape-3 {
    width: 180px;
    height: 35px;
    background: linear-gradient(90deg, #BB8FCE, #85C1E2);
    opacity: 0.7;
    bottom: 0;
    left: 15%;
    transform: rotate(3deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.washi-tape-4 {
    width: 140px;
    height: 25px;
    background: linear-gradient(60deg, #F8B739, #F1948A);
    opacity: 0.7;
    bottom: 0;
    right: 25%;
    transform: rotate(-6deg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* 主容器 */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
    z-index: 10;
}

/* 宝丽来照片效果 */
.PolaroidEffect {
    background: white;
    padding: 15px;
    border-radius: 2px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        0 1px 3px rgba(0, 0, 0, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.PolaroidEffect:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 3px 10px rgba(0, 0, 0, 0.1);
}

.PolaroidEffect::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 1px solid rgba(139, 69, 19, 0.1);
    border-radius: 4px;
    z-index: -1;
}

/* 游戏标题 */
.game-header {
    text-align: center;
    margin-bottom: 30px;
    padding: 30px;
    background: linear-gradient(135deg, var(--card-color) 0%, #FFFFFF 100%);
}

.handwritten-title {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    letter-spacing: 2px;
}

.subtitle {
    font-size: 1.2rem;
    color: var(--secondary-color);
    font-style: italic;
}

/* 游戏信息栏 */
.game-info-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    gap: 20px;
    flex-wrap: wrap;
}

.info-card {
    flex: 1;
    min-width: 250px;
    display: flex;
    justify-content: space-around;
    padding: 20px;
    background: linear-gradient(135deg, var(--paper-color) 0%, var(--card-color) 100%);
}

.info-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
    font-weight: bold;
}

.info-item i {
    color: var(--accent-color);
    font-size: 1.3rem;
}

.difficulty-selector {
    padding: 15px 20px;
    background: linear-gradient(135deg, #E8F5E8 0%, #F0F8F0 100%);
}

.difficulty-selector label {
    margin-right: 10px;
    font-weight: bold;
    color: var(--primary-color);
}

.difficulty-selector select {
    padding: 8px 15px;
    border: 2px solid var(--secondary-color);
    border-radius: 20px;
    font-family: var(--handwritten-font);
    font-size: 1rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.3s ease;
}

.difficulty-selector select:focus {
    outline: none;
    border-color: var(--accent-color);
}

/* 游戏区域 */
.game-container {
    min-height: 600px;
    position: relative;
}

.game-screen {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.game-screen.active {
    opacity: 1;
    visibility: visible;
}

/* 开始界面 */
.start-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--paper-color) 0%, #FFFFFF 100%);
    max-width: 600px;
    margin: 0 auto;
}

.start-content h2 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 30px;
}

.game-rules {
    text-align: left;
    margin: 30px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
}

.game-rules h3 {
    color: var(--secondary-color);
    margin-bottom: 15px;
    font-size: 1.5rem;
}

.game-rules ul {
    list-style: none;
    padding-left: 0;
}

.game-rules li {
    margin: 10px 0;
    padding-left: 30px;
    position: relative;
    font-size: 1.1rem;
}

.game-rules li::before {
    content: '✂️';
    position: absolute;
    left: 0;
    color: var(--accent-color);
}

/* 复古按钮 */
.vintage-btn {
    padding: 15px 30px;
    font-size: 1.2rem;
    font-weight: bold;
    font-family: var(--handwritten-font);
    color: white;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    border: 3px solid var(--primary-color);
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 10px;
    box-shadow:
        0 4px 6px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.vintage-btn:hover {
    transform: translateY(-2px);
    box-shadow:
        0 8px 15px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
}

.vintage-btn:active {
    transform: translateY(0);
}

/* 记忆界面 */
.memory-content {
    text-align: center;
    padding: 30px;
}

.countdown-text {
    font-size: 2rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.countdown-container {
    display: inline-block;
    padding: 20px 40px;
    margin-bottom: 30px;
    background: linear-gradient(135deg, #FFE4E1 0%, #FFF0F5 100%);
}

#countdown {
    font-size: 4rem;
    font-weight: bold;
    color: var(--accent-color);
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

/* 卡牌网格 */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 20px;
    margin-top: 30px;
    padding: 30px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
}

.card {
    width: 120px;
    height: 120px;
    background: linear-gradient(135deg, var(--card-color) 0%, #FFFFFF 100%);
    border: 3px solid var(--secondary-color);
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    margin: 0 auto;
}

.card:hover {
    transform: translateY(-5px) rotate(2deg);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.card.flipped {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    transform: rotateY(180deg);
}

.card-label {
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.9rem;
    color: var(--text-color);
    font-weight: bold;
}

/* 测试界面 */
.test-content {
    text-align: center;
    padding: 30px;
}

.test-content h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.test-instructions {
    margin-bottom: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #E8F5E8 0%, #F0FFF0 100%);
    font-size: 1.2rem;
    color: var(--text-color);
}

/* 卡牌选择器 */
.card-selector {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 15px;
}

.selectable-card {
    padding: 15px 20px;
    background: linear-gradient(135deg, var(--card-color) 0%, #FFFFFF 100%);
    border: 2px solid var(--secondary-color);
    border-radius: 20px;
    font-size: 2rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.selectable-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.selectable-card.selected {
    background: linear-gradient(135deg, var(--accent-color) 0%, #FF8A80 100%);
    border-color: var(--accent-color);
    transform: scale(1.1);
}

/* 位置网格 */
.position-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 15px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.position-slot {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #F5F5F5 0%, #E0E0E0 100%);
    border: 2px dashed var(--secondary-color);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--text-color);
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 80px;
    min-height: 80px;
}

.position-slot:hover {
    background: linear-gradient(135deg, var(--paper-color) 0%, var(--card-color) 100%);
    border-style: solid;
    transform: scale(1.05);
}

.position-slot.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.position-slot.correct {
    background: linear-gradient(135deg, #90EE90 0%, #98FB98 100%);
    border-color: #228B22;
    animation: correctPulse 1s ease;
}

.position-slot.incorrect {
    background: linear-gradient(135deg, #FFB6C1 0%, #FFC0CB 100%);
    border-color: var(--accent-color);
    animation: incorrectShake 0.5s ease;
}

/* 结果消息 */
.result-container {
    margin-top: 20px;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-message {
    padding: 20px 30px;
    font-size: 1.3rem;
    font-weight: bold;
    text-align: center;
    max-width: 500px;
}

.result-message.success {
    background: linear-gradient(135deg, #90EE90 0%, #98FB98 100%);
    color: #006400;
    border: 2px solid #228B22;
}

.result-message.error {
    background: linear-gradient(135deg, #FFB6C1 0%, #FFC0CB 100%);
    color: #8B0000;
    border: 2px solid var(--accent-color);
}

/* 结果界面 */
.result-content {
    text-align: center;
    padding: 40px;
    background: linear-gradient(135deg, var(--paper-color) 0%, #FFFFFF 100%);
    max-width: 600px;
    margin: 0 auto;
}

.result-content h2 {
    font-size: 2.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.final-score {
    font-size: 1.5rem;
    margin: 30px 0;
    color: var(--secondary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
}

.final-score i {
    color: gold;
    font-size: 2rem;
}

.performance-message {
    font-size: 1.3rem;
    margin: 20px 0;
    padding: 20px;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    color: var(--text-color);
}

.action-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 30px;
    flex-wrap: wrap;
}

/* 模态框 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: linear-gradient(135deg, var(--paper-color) 0%, #FFFFFF 100%);
    margin: 5% auto;
    padding: 30px;
    border-radius: 15px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.close {
    color: var(--text-color);
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: var(--accent-color);
}

.modal-content h2 {
    text-align: center;
    color: var(--primary-color);
    margin-bottom: 20px;
}

/* 排行榜 */
.leaderboard-content {
    margin-top: 20px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 10px;
    border-left: 4px solid var(--secondary-color);
}

.leaderboard-item:nth-child(1) {
    border-left-color: gold;
    background: linear-gradient(135deg, #FFEFBA 0%, #FFF8DC 100%);
}

.leaderboard-item:nth-child(2) {
    border-left-color: silver;
    background: linear-gradient(135deg, #F0F0F0 0%, #F8F8F8 100%);
}

.leaderboard-item:nth-child(3) {
    border-left-color: #CD7F32;
    background: linear-gradient(135deg, #FFE4CC 0%, #FFF5EE 100%);
}

.leaderboard-rank {
    font-weight: bold;
    font-size: 1.2rem;
    color: var(--primary-color);
    min-width: 30px;
}

.leaderboard-name {
    flex: 1;
    margin: 0 15px;
    font-weight: 500;
}

.leaderboard-score {
    font-weight: bold;
    color: var(--secondary-color);
    font-size: 1.1rem;
}

.leaderboard-date {
    font-size: 0.9rem;
    color: #666;
}

/* 动画 */
@keyframes correctPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

@keyframes incorrectShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-20px); }
    to { opacity: 1; transform: translateX(0); }
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }

    .game-info-container {
        flex-direction: column;
        gap: 15px;
    }

    .info-card {
        min-width: 100%;
    }

    .handwritten-title {
        font-size: 2rem;
    }

    .card-grid {
        grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
        gap: 15px;
        padding: 20px;
    }

    .card {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .position-grid {
        grid-template-columns: repeat(auto-fit, minmax(60px, 1fr));
        gap: 10px;
    }

    .position-slot {
        min-width: 60px;
        min-height: 60px;
        font-size: 1rem;
    }

    .action-buttons {
        flex-direction: column;
        align-items: center;
    }

    .vintage-btn {
        width: 200px;
    }
}

@media (max-width: 480px) {
    .handwritten-title {
        font-size: 1.5rem;
    }

    .start-content, .result-content {
        padding: 20px;
    }

    .card-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .card {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }

    .selectable-card {
        font-size: 1.5rem;
        padding: 10px 15px;
    }

    .position-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}